import request from '@/utils/request'
import type { ArticleQA, ArticleQAQuery, ArticleQAStatistics, SceneType, Page } from '@/api/types'

// 分页获取问答列表
export function getQAList(params: ArticleQAQuery) {
  return request.get<Page<ArticleQA>>('/api/qa', { params })
}

// 获取问答详情
export function getQADetail(id: number) {
  return request.get<ArticleQA>(`/api/qa/${id}`)
}

// 创建问答
export function createQA(data: Partial<ArticleQA>) {
  return request.post('/api/qa', data)
}

// 更新问答
export function updateQA(id: number, data: Partial<ArticleQA>) {
  return request.put(`/api/qa/${id}`, data)
}

// 删除问答
export function deleteQA(id: number) {
  return request.delete(`/api/qa/${id}`)
}

// 获取统计信息
export function getQAStatistics() {
  return request.get<Page<ArticleQA>>('/api/qa')
}

// 获取所有场景类型
export function getSceneTypes() {
  return request.get<SceneType[]>('/api/qa/scene-types')
} 